<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Vue页面结构</title>
    <script src="./lib/vue-2.4.0.js"></script>
</head>
<body>
    <div id="app">
        <p>姓:<input type="text" placeholder="firstName" v-model='firstName'></p>
        <p>名:<input type="text" placeholder="lastName" v-model='lastName'></p>
        <p>全名:{{fullName}}</p>
    </div>
</body>
<script>
    var vm=new Vue({
        el:'#app',
        data:{
            firstName:'',
            lastName:'',
        },
        methods:{
        },
        //通过data里已经存在的属性,计算出新的属性,该新属性不应该在data中定义
        computed:{
            //函数名为要计算的新属性
            fullName(){
                return this.firstName+this.lastName;
            }
        }
    });
</script>
</html>